﻿using System;
using MCP.BL.Messages;

namespace MCP.BL
{
    public abstract class OperationResultBase
    {
        /// <summary>
        /// Was operation successful?
        /// </summary>
        public bool Success { get; set; }

        /// <summary>
        /// Messages that should be indicated after operation finished.
        /// </summary>
        public MessagePool Messages { get; set; }

        /// <summary>
        /// Exception occured if any.
        /// </summary>
        public Exception Exception { get; set; }

       protected OperationResultBase(bool success, Exception exception, params MessageBase[] messages)
        {
            this.Success = success;
            this.Exception = exception;
            this.Messages = MessagePool.Create(messages, exception);
        }

        //public abstract OperationResultBase GetSuccessfulResult(params MessageBase[] messages);
        //public abstract OperationResultBase GetFailedResult(params MessageBase[] messages);
        //public abstract OperationResultBase GetFailedResult(Exception exception, params MessageBase[] messages);
    }
}